#include <errno.h>
#include <unistd.h>

#include <irt_syscalls.h>

int __close (int fd) {
  ENOSYS_IF_NULL(__nacl_irt_close)

  int result = __nacl_irt_close(fd);
  if (result != 0) {
    errno = __nacl_abi_errno_to_errno(result);
    return -1;
  }
  return 0;
}

weak_alias (__close, close)
